<?php

class Engine_View_Helper_Menu {
	protected $items = array();
	public $title;

	public function __construct() {
        $this->title = 'Действия';
	}

	//Написать генератор меню для класса
	public function __toString() {
       $result = "<ul class='dropdown-menu'>";

       foreach ($this->items as $item) {
           $result .= "<li>";
                      $result .= "<a href='" . $item['href'] . "'>" . $item['name'] . "</a></li>";
       }
       $result .= "</ul>";

       return $result;
	}

    public function renderMainItems() {
        $mMenu = new Engine_Data_Model_Menu();
        $mainItems = $this->items = $mMenu->getMainMenuItems();
        $result = '';
        foreach ($mainItems as $item) {
            $result .= '<a class="metro tile wide app" href="' . $item['href'] . '">';
            $result .= '<div class="image-wrapper">';
            $result .= '<span class="fs1 main-tile" data-icon="' . $item['icon'] . '" aria-hidden="true"></span>';
            $result .= '</div>';
            $result .= '<div class="app-label">' . $item['name'] . '</div>';
            $result .= '<div class="app-count"></div>';
            $result .= '</a>';
        }

        return $result;
    }
}